<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.util.List"%>
<%@page import="javax.jdo.PersistenceManager"%>
<%@page import="cn._2dland.access.jdo.*"%>
<%
	Long userID = (Long)session.getAttribute("LoginUserID");
	if(userID == null) response.sendRedirect("/console/login.jsp");

	String videoTitle = request.getParameter("videotitle");
	String videoURL = request.getParameter("videourl");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>新增视频</title>
	<link rel="stylesheet" type="text/css" href="/style/style.css">
</head>
<body>
<%
	Video video = VideoManager.addVideo(videoTitle, videoURL, userID);
	if(video != null) {
%>
	<table border="0" cellpadding="2" cellspacing="0" class="form-table">
		<tr>
			<td align="right">盗链地址</td>
			<td>
				<input type="text" name="videolink" readonly="readonly" value="https://project2dl.appspot.com/link?vid=<%=video.getVideoID()%>" style="width:320px;">
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td align="right"><input type="button" value="关闭" onclick="window.close();"></td>
		</tr>
	</table>
	<script type="text/javascript">
		opener.location.reload();
	</script>
<%
	} else {
%>
	<script type="text/javascript">
		window.alert('保存失败！');
		history.back();
	</script>
<%
	}
%>
</body>
</html>